home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / shells / cshel40a / part03 < prev   
Encoding:
Internet Message Format  |  1991-02-07  |  49.8 KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i005: CShell 4.02A - alternative command interface, Part03/03
  4. Reply-To: Cesare.Dieni@p1.f602.n332.z2.fidonet.org (Cesare Dieni)
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v91i005@ab20.larc.nasa.gov>
  7. References: <comp.sources.amiga:v91i003@ab20.larc.nasa.gov>
  8. Date: 07 Feb 91 00:54:57 GMT
  9. Approved: tadguy@uunet.UU.NET (Tad Guy)
  10. X-Mail-Submissions-To: amiga@uunet.uu.net
  11. X-Post-Discussions-To: comp.sys.amiga.misc
  12.  
  13. Submitted-by: Cesare.Dieni@p1.f602.n332.z2.fidonet.org (Cesare Dieni)
  14. Posting-number: Volume 91, Issue 005
  15. Archive-name: shells/cshell-4.02a/part03
  16.  
  17. #!/bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 3 (of 3)."
  24. # Contents:  shell.doc
  25. # Wrapped by tadguy@ab20 on Wed Feb  6 19:54:19 1991
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'shell.doc' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'shell.doc'\"
  29. else
  30. echo shar: Extracting \"'shell.doc'\" \(47293 characters\)
  31. sed "s/^X//" >'shell.doc' <<'END_OF_FILE'
  32. X
  33. X        INSTRUCTIONS FOR SHELL VERSION: 4.02A 18-Nov-90
  34. X        ===============================================
  35. X
  36. X  Contents
  37. X  --------
  38. X
  39. X    O.    Changes over old versions
  40. X    I.    Description
  41. X    II.    Overview of Major features
  42. X    III.    Restrictions
  43. X    IV.    PIPES
  44. X    V.    Command Pre-processor
  45. X    VI.    Command Line Editing
  46. X    VII.    Function Keys
  47. X    VIII.    Shell Commands
  48. X    IX.    Special Set Variables
  49. X    X.    Advanced Topics
  50. X    XI.    Example source files
  51. X    XII.    Default values
  52. X    XIII.    Why ARP ?
  53. X
  54. X
  55. X
  56. XO.  Changes over old versions
  57. X-----------------------------
  58. X
  59. XNew to 4.02A:
  60. X- Fixed bug that caused loss of memory on exit.
  61. X- cp now copies protection bits; use -f switch if you want to avoid this.
  62. X- Added  commands: man (and alias manlist), uniq, head, tail, tee.
  63. X- This doc has been reformatted to work with man.
  64. X
  65. XNew to 4.01A:
  66. X
  67. X- This version features mostly bug fixes and corrections:
  68. X * Window title is restored after quitting.
  69. X * rxrec now answers to the 'bye' message.
  70. X * rpn can now be redirected and piped; however, this causes
  71. X    some problem (see rpn for info).
  72. X * resident list now works with ARP 1.3. To recompile source, you must
  73. X    modify include file "libraries/arpbase.h".
  74. X    Change definition of rpn_Usage in struct ResidentProgramNode from LONG
  75. X    to WORD.
  76. X * pri no more assumes 20 CLI maximum.
  77. X * you can now split long lines in source files even into more than 2 lines.
  78. X- Added much info in this doc about source files (chapter XI)
  79. X- Added copyright notice (see under restrictions).
  80. X
  81. XNew to 4.00A:
  82. X
  83. X- This version is called 4.00A because it is not 100% compatible with
  84. X  previous versions. We choose to accept this in order to better support
  85. X  the new ARP.library 1.3.
  86. X- External commands are searched in a different order than before; Shell
  87. X  path is now searched AFTER current directory, AmigaDOS path and C:.
  88. X- ARP pattern matching has been implemented (in part for line arg expanding,
  89. X  fully for search -w).
  90. X- Internal changes for various optimizations.
  91. X- Search command has been improved in several ways.
  92. X- New commands: basename, tackon.
  93. X- New options: if -v, resident -d, fornum -v -s, dir -n.
  94. X- Fixed bugs with dir (some dirs remained locked), foreach -v, htype
  95. X  (blanks were treated as binary), info (for devices > 32M).
  96. X- rback command now works ok (run, however, doesn't).
  97. X- Oh, I forgot: it also has an AREXX port... And you don't even have to get
  98. X  AREXX to use it. See new commands rxsend, rxrec
  99. X
  100. XNew to 3.03A:
  101. X
  102. X- New filter commands fltlower, fltupper.
  103. X- Added configuration file feature: now if you have a file named S:.login,
  104. X  it will be sourced for every Shell you start.
  105. X- New option dir -c.
  106. X- New editing feature: shift-left(right) arrow move cursor to previous(next)
  107. X  word.
  108. X- Bugs fixed: alias command wasn't listed in help; typing a number as a
  109. X  command was interpreted like 'alias'.
  110. X
  111. XNew to 3.02A:
  112. X
  113. X- New commands: fornum, forline, strleft, strright, strmid, strlen, exec.
  114. X- Improved commands: foreach, pri.
  115. X- New system variable _clinumber.
  116. X- You can now split long lines in source files (see source for details).
  117. X- window -q now lists also position of screens/windows, not only dimension.
  118. X- Since strings are handled directly from Shell with new commands,
  119. X  rpn is now used only for calculations; string commands are gone.
  120. X  However, now RPN is really usable.
  121. X- Changed rawgets() to fix some problems with function keys, multi-line
  122. X  editing and window resizing; also, fixed bug with ^E.
  123. X- cat now warns you if it can't find any file matching your pattern.
  124. X- Now uses DOS packets to get ptr to CLI window; this fixes a bug that
  125. X  caused problems if Shell was run on unactive windows.
  126. X- Fixed minor bugs (htype printed some more ASCII bytes, some commands
  127. X  returned random values, history didn't print CR's).
  128. X- Heavy mods to this file.
  129. X
  130. X
  131. XI.  DESCRIPTION
  132. X---------------
  133. X
  134. XThis version of Shell is the follow of:
  135. X    Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
  136. X    Shell V2.04M-V2.07M by Steve Drew
  137. X    Shell V2.08MI, V3.xxA and V4.xxA by Carlo Borreo & Cesare Dieni
  138. X
  139. XSend suggestions/criticism/anything else to Carlo Borreo or Cesare Dieni at:
  140. X
  141. X    BITNET:  PERUGIA@ICNUCEVM.BITNET
  142. X    FIDONET: 2:332/602.0@FIDONET        # recently changed
  143. X
  144. Xor
  145. X    Carlo Borreo        Cesare Dieni
  146. X    Via G. Berio 34        Via G. Taddei 3
  147. X    I-18100 Imperia        I-56100 Pisa
  148. X    Italy            Italy
  149. X
  150. XYou may distribute this program unmodified and for non-profit only.
  151. X
  152. X*** YOU MAY NOT MODIFY THIS PROGRAM AND REDISTRIBUTE IT ***
  153. X
  154. XIf everyone writes his own version of Shell and distributes it, we would be
  155. Xcovered by Shell versions.
  156. X
  157. XIf you make a modification to Shell that you would like to share with other
  158. Xusers, please send us a DIFF output, or a description of what you need.
  159. X
  160. XATTRIBUTIONS
  161. X------------
  162. X
  163. XArexx is a program by William Hawes.
  164. XCygnus Ed Professional (C) 1988 CygnusSoft Software.
  165. X
  166. XII. OVERVIEW
  167. X------------
  168. X
  169. XShell provides a convient AmigaDos alternative command interface.
  170. XAll its commands are internal and thus does not rely on the c:
  171. Xcommands for any functionality.
  172. X
  173. XMajor features include:
  174. X
  175. X    -command line editing
  176. X    -shell & Amigados search path support
  177. X    -simple history
  178. X    -redirection of any command
  179. X    -piping
  180. X    -aliases
  181. X    -variables & variable handling (embedded variables)
  182. X    -file name expansion via conventional wild carding ('?', '*' and more)
  183. X    -conditionals (if/else ect..)
  184. X    -source files  (w/ gotos and labels)
  185. X    -many built in commands to speed things up
  186. X
  187. X
  188. XIII. RESTRICTIONS
  189. X-----------------
  190. X
  191. X   AmigaDos execute command will not work.  Alternative is to use shell own
  192. Xscript language (which is more powerful) or to do a 'run execute'.
  193. X   VDK  handler  has  a  bug with setting file dates so when using the copy
  194. Xcommand  and  VDK  you should use the -d switch otherwise your file date in
  195. Xvdk:  will be bad.  (This is not a bug with shell)
  196. X   If  using  with  conman it may be best to start shell with the -a switch
  197. X(shell  -a .login) to turn off shell's command line editing and use conmans
  198. Xinstead.
  199. X   You  can't  use  chars  with  code  >  127  (i.e., all national symbols,
  200. Xstressed  letters,  and  so  on).   8th bit is used internally for a lot of
  201. Xthings in Shell.
  202. X
  203. X
  204. XIV. NOTES ON PIPES
  205. X------------------
  206. X
  207. X    PIPES
  208. X    PIPES have been implemented using temporary RAM:  files.  Thus, you
  209. X    should  be  careful when specifying a 'ram:*' expansion as it might
  210. X    include the temp.  files.  These files are deleted on completion of
  211. X    the pipe segment.
  212. X
  213. X    The file names used are completely unique, even with multiple shell
  214. X    running simultaneously.
  215. X
  216. X    My  favorite  new  feature is the fact that you can now redirect to
  217. X    and  from,  and pipe internal commands.  'echo charlie >ram:x', for
  218. X    instance.  Another favorite:
  219. X
  220. X    echo "echo mem | shell" | shell
  221. X
  222. X    To accomplish these new features, I completely re-wrote the command
  223. X    parser in execom.c
  224. X
  225. X    NO BCPL program should be output-append redirected (>>).
  226. X
  227. X
  228. XV.  COMMAND PRE-PROCESSOR
  229. X-------------------------
  230. X
  231. X    PREPROCESSING
  232. X    Preprocessing is done on the command line before it is passed on to
  233. X    an internal or external routine:
  234. X
  235. X    ^c    where c is a character is converted to that control character.
  236. X        Thus, say '^l' for control-l.
  237. X
  238. X    $name    where name is a variable name.  Variable names can consist of
  239. X        0-9, a-z, A-Z, and underscore (_).  The contents of the
  240. X        specified variable is used.  If the variable doesn't exist,
  241. X        the specifier is used.  That is, if the variable 'i' contains
  242. X        'charlie', then '$i' -> 'charlie'.  If the variable 'i' doesn't
  243. X        exist, then '$i'->'$i' .
  244. X
  245. X    ;    delimits commands.   echo charlie ; echo ben.
  246. X
  247. X    ' '    (a space). Spaces delimit arguments.
  248. X
  249. X    "string" a quoted string.  For instance, if you want to echo five spaces
  250. X        and an 'a':
  251. X
  252. X        echo      a       -> a
  253. X        echo "    a"      ->      a
  254. X
  255. X    \c    overide the meaning of special characters.  '\^a' is a
  256. X        circumflex and an a rather than control-a.  To get a backslash,
  257. X        you must say '\\'.
  258. X
  259. X        also used to overide alias searching for commands.
  260. X
  261. X    >file    specify output redirection.  All output from the command is
  262. X        placed in the specified file.
  263. X
  264. X    >>file    specify append redirection (Does not work with BCPL programs).
  265. X
  266. X    <file    specify input redirection. The command takes input from the
  267. X        file rather than the keyboard (note: not all commands require
  268. X        input; it makes no sense to say 'echo <charlie' since
  269. X        the 'echo' command only outputs its arguments).
  270. X
  271. X    |    PIPE specifier.  The output from the command on the left becomes
  272. X        the input to the command on the right.  The current SHELL
  273. X        implimentation uses temporary files to store the data.
  274. X
  275. X    !!    execute the previously executed command.
  276. X    !nn    (nn is a number).  Insert the history command numbered n (see
  277. X        the HISTORY command)
  278. X    !partial search backwards through the history list for a command which
  279. X        looks the same as 'partial', and execute it.
  280. X
  281. X    #    Enter comment.  The rest of the line is discarded (note: \#
  282. X        will, of course, overide the comment character's special
  283. X        meaning)
  284. X
  285. X
  286. XVI. COMMAND LINE EDITING
  287. X------------------------
  288. X
  289. X    EDITING
  290. X    o Command line can be up to 255 chars.
  291. X    o Inserts  and  deletes  are handled correctly over multiple screen
  292. X    lines.
  293. X    o Shell  will  keep  track  of the line width should the window get
  294. X    resized.
  295. X
  296. X    KEY DEFINITIONS:
  297. X        Up Arrow    Recall previous commands
  298. X        Down Arrow  Recall commands
  299. X        Left Arrow  Move cursor about command line.
  300. X        Right Arrow  "     "      "      "      "
  301. X        Shift-Up Arrow    Get start of history
  302. X        Shift-Down Arrow   "  end   "     "
  303. X        Shift-Left Arrow  Moves cursor a word left
  304. X        Shift-Right Arrow   "     "    "  "   right
  305. X        ^A        Toggle insert/overtype mode.
  306. X        ^D        EOF (exits Shell)
  307. X        ^E        Put cursor at end of text.
  308. X        ^K        Delete to end of line.
  309. X        ^R        Retype current line.
  310. X        ^U        Erase entire line.
  311. X        ^X        Erase entire line.
  312. X        ^Z        Put cursor at start of text.
  313. X        f1 - f10    Execute command if variable exists.
  314. X        F1 - F10    More commands (Shifted f keys).
  315. X        Help        Invokes help command
  316. X
  317. X
  318. XVII. FUNCTION KEYS
  319. X---- -------------
  320. X
  321. X    FUNKEY
  322. X    Function keys now insert text to the current position on the command
  323. X    line. They maybe terminated with a ^M (return). f1 would be non shifted
  324. X    where as F1 is shifted.
  325. X    Most of functions key have a default definition, but it may be changed.
  326. X
  327. X        $ set f1 dir df0:^M
  328. X
  329. X    will add the text 'dir df0:<return>' to the current line.
  330. X
  331. X        $ set f1 dir
  332. X
  333. X    would only add 'dir' you could then enter ' df0:<return>'
  334. X
  335. X
  336. XVIII. SHELL COMMANDS
  337. X--------------------
  338. X
  339. X    First to start shell from a CLI
  340. X
  341. X        shell [-a] [-c command;command]
  342. X
  343. X    where:
  344. X        -a  disables  all  command  line editing features.  This is
  345. X        useful  for  when running shell over AUX:, and necessary if
  346. X        you are running CONMAN.
  347. X
  348. X        -c  allows execution of one command line and then exits out
  349. X        of  shell.   This  is  useful for running an internal shell
  350. X        commands in the background or from an external application.
  351. X
  352. X        eg:
  353. X
  354. X        Run shell -c dir df0:; copy -r df0: df1: >nil:; echo Done
  355. X
  356. X    If you 'Run' shell in the background without the -c switch shell
  357. X    will detect this and imediately exit.
  358. X
  359. X    Command execution:
  360. X
  361. X    Internal shell commands maybe abreviated.
  362. X
  363. X    The  first  argument is the command-name...  here is (in order) how
  364. X    Shell tries to execute it:
  365. X
  366. X    1) Alias list is searched for an alias exactly matching name.
  367. X    2) Internal commands list is scanned for a command even partially
  368. X       matching name (so you can, for instance, say resi for resident;
  369. X       however, you should specify enough of a command to be unique).
  370. X    3) ARP resident list is scanned (you can use Shell's resident
  371. X       command to add/remove a file in this list).
  372. X    4) At this point, command is supposed to be external (disk), and
  373. X       is searched before in current directory, then in AmigaDOS
  374. X       path, in C:, and finally in Shell path.
  375. X    5) As a last chance, AUTOMATIC SOURCING is tried, first in
  376. X       current directory, then in Shell path.
  377. X
  378. X    AUTOMATIC SOURCING may be accomplished by naming shell scripts with
  379. X    a  .sh  suffix.   Thus,  if you say 'stuff' and the file 'stuff.sh'
  380. X    exists in your current or anywhere in Shell search path, it will be
  381. X    SOURCED  with  any  arguments  you  have  placed  in  the  $_passed
  382. X    variable. This is equivalent to typing 'source stuff.sh'
  383. X
  384. X    WILDCARDS EXPANSION
  385. X    Most shell commands will accept multiple arguments that can
  386. X    be as a result of wild card expansion.  Also when calling
  387. X    an external command shell will first expand any wild cards
  388. X    to seperate arguments.  If you wish to have the external command
  389. X    handle it's own wild carding you will need to insert quotes
  390. X    around the special wild card characters.
  391. X
  392. X    eg.
  393. X        arc a new.arc *.txt    - shell will expand and pass to arc
  394. X        arc a new.arc "*.txt"    - let arc expand the wild cards.
  395. X
  396. X    Wildcards allowed:
  397. X
  398. X    ?    match any single character
  399. X    *    match any string
  400. X    .../*    recursive search down ALL sub directories from current level
  401. X    ~    exclude pattern matching specifier
  402. X    !    synonim for ~, supported for compatibility
  403. X    &    prefixed to patterns, ask confirmation for each file
  404. X    []    character class
  405. X
  406. X    Examples:
  407. X
  408. X    df0:.../*        all files in all directories on df0:
  409. X    df0:.../!*.info     full directory tree of df0: but exclude
  410. X                any ugly .info files.
  411. X    !*.o !*.c        will result in ALL files matching since what
  412. X                doesn't match the !*.o will match the !*.c
  413. X    df1:&*            all files in root of df1:, but ask 
  414. X                confirmation for each
  415. X    *.[co]            all files ending in .c or .o
  416. X    ~*.[co]            all files NOT ending in .c nor in .o
  417. X
  418. X
  419. X    The   following   symbols  are  not  yet  supported  by  wild  card
  420. X    expansions, but are accepted in search -w.
  421. X
  422. X    ( | )    OR matching
  423. X    #    0 or more times the pattern following
  424. X
  425. X    Examples:
  426. X
  427. X    k#a        matches ka, kaa, kaaa, etc.
  428. X    hel(lo|p)    matches hello or help.
  429. X
  430. X
  431. XLIST OF COMMANDS:
  432. X-----------------
  433. X
  434. X    ABORTLINE
  435. X    Usage    : abortline
  436. X    Example    : echo a;abort;echo b
  437. X    Results    : a
  438. X
  439. X    Causes the rest of the line to be aborted. Intended for use in
  440. X    conjunction with exception handling.
  441. X
  442. X    ADDBUFFERS
  443. X    Usage    : addbuffers drive buffers
  444. X    Example    : addbuffers df0: 24
  445. X
  446. X    Just like AmigaDOS addbuffer command, causes new buffers to be
  447. X    allocated for disk I/O. Each buffer costs 512 bytes of CHIP memory.
  448. X
  449. X    ALIAS
  450. X    Usage    : alias [name [command string] ]
  451. X    Example    : alias vt "echo Starting VT100;run sys:tools/vt100"
  452. X
  453. X    Sets a name to be a string. You can alias a single name to a set
  454. X    of commands if you enclose them in quotes as above. By simply
  455. X    typing vt, the command line above would be executed.
  456. X
  457. X    Argument Passing to an Alias:
  458. X
  459. X    Usage    : alias name "%var [command string]"
  460. X    Example    : alias xx "%q echo hi $q, how are ya."
  461. X          xx Steve
  462. X    Results    : hi Steve, how are ya.
  463. X
  464. X    The second form of the alias command allows passing of arguments
  465. X    to any position within the command string via use of a variable
  466. X    name. To pass arguments to the end of a command string this method
  467. X    is actually not necessary.
  468. X
  469. X    Typing "alias name" you will get the alias for that name, while with
  470. X    "alias" you get a list of all alias.
  471. X
  472. X    ASET
  473. X    Usage    : aset name value
  474. X    Example    : aset INCLUDE include:
  475. X
  476. X    Set a variable in a way that is compatible with Aztec SET command;
  477. X    this is completely different from Shell variable.
  478. X    May even be used to set ARP variables.
  479. X
  480. X    ASSIGN
  481. X    Usage    : assign [logical [physical] ]
  482. X    Example    : assign C: df1:c
  483. X
  484. X    Use it like AmigaDOS assign command to set, remove or list
  485. X    assignments of logical names to directories.
  486. X
  487. X    BASENAME
  488. X    Usage    : basename var path
  489. X    Example    : basename x df0:c/Dir    # sets x to "Dir"
  490. X
  491. X    Sets var specified to basename of path.
  492. X
  493. X    CAT
  494. X    Usage    : cat [-n][file file....]
  495. X    Example    : cat foo.txt
  496. X
  497. X    Type the specified files onto the screen.  If no file is specified,
  498. X    STDIN in used.  CAT is meant to output text files only.
  499. X    Specifying -n option you will get numbered lines.
  500. X
  501. X    CD
  502. X    Usage    : cd [path]
  503. X    Example    : cd df0:devs/printers
  504. X
  505. X    Change your current working directory.  You may specify '..' to go
  506. X    back one directory (this is a CD specific feature, and does not
  507. X    work with normal path specifications).
  508. X
  509. X    CD without any arguments displays the path of the directory you
  510. X    are currently in.
  511. X
  512. X    CLOSE
  513. X    Usage    : close filenumber
  514. X
  515. X    Close the specified file opened by open.
  516. X    See open and flist for more info.
  517. X
  518. X    COPY (CP)
  519. X    Usage    : copy [-u][-d][-f] file file
  520. X    or    : copy [-u][-d][-f] file1 file2...fileN dir
  521. X    or    : copy [-r][-u][-d][-f] dir1 dir2...dirN dir
  522. X    options    :
  523. X        -r    recursive, copy all subdirectories as well.
  524. X        -u    update, if newer version exist on dest, don't copy
  525. X        -d    don't set destination file date to that of source.
  526. X        -f    don't set destination file bits to those of source.
  527. X
  528. X    Example    : copy -r df0: df1:
  529. X
  530. X    Copy files or directories. When copying directories, the -r option
  531. X    must be specified to copy subdirectories as well.  Otherwise, only
  532. X    top level files in the source directory are copied.
  533. X
  534. X    All files will be displayed as they are copied and directory's
  535. X    displayed as they are created. This output can be suppessed by
  536. X    redirecting to nil: eg. copy -r >nil: df0: df1:
  537. X
  538. X    Copy will abort after current file on Control-C.
  539. X
  540. X    Copy by default sets the date of the destination file to that of
  541. X    the source file. To overide this feature use the -d switch.
  542. X
  543. X    Similarly, it sets protection bits (flags) to those of source.
  544. X    To avoid this use -f.
  545. X
  546. X    Another useful option is the -u (update) mode were copy will not
  547. X    copy any files which exists already in the destination directory
  548. X    if the destination file is newer or equal to the source file.
  549. X    This is useful when developing code say in ram: eg. 'copy *.c ram:'
  550. X    when done you can copy -u ram: df1: and only those modules you have
  551. X    modified will be copied back.
  552. X
  553. X    Copy command will now create the destination directory if it does
  554. X    not exist when specified as 'copy [-r] dir dir'. If you specify
  555. X    copy file file file dir, then 'dir' must already exist.
  556. X
  557. X    CP
  558. X    Equivalent to copy.
  559. X
  560. X    DATE
  561. X    Usage    : date [new date and/or time]
  562. X    Example    : date Wednesday  # this refers to NEXT wed, of course
  563. X
  564. X    Used to read or set system date and/or time. All standard options
  565. X    may be used (yesterday, tomorrow, monday, etc.).
  566. X    Leading zero's are not necessary.
  567. X    Without parameters shows Dddddd DD-MMM-YY HH:MM:SS.
  568. X
  569. X    DEC
  570. X    Usage    : dec varname [value]
  571. X    Example    : dec abc
  572. X
  573. X    Decrement the numerical equivalent of the variable with specified
  574. X    value (default: 1) and place the ASCII-string result back into
  575. X    that variable.
  576. X
  577. X    DELETE (RM)
  578. X    Usage    : delete [-p][-r] file file file...
  579. X    Example    : delete foo.txt test.c
  580. X
  581. X    Remove (delete) the specified files.  Remove always returns
  582. X    errorcode 0.  You can remove empty directories.  The '-r' option
  583. X    will remove non-empty directories by recursively removing all sub
  584. X    directories.
  585. X    You can remove delete-protected files specifying -p option.
  586. X    If you specify any wildcard deletes the files will be listed as
  587. X    they are deleted. This can be suppressed by redirecting to nil:
  588. X
  589. X    DIR (LS)
  590. X    Usage    : dir [-sdfcn] [path path ... ]
  591. X    Example    : dir df0:
  592. X    options    :
  593. X        -s  short multi(4) column display.
  594. X        -d  list directories only
  595. X        -f  list files only
  596. X        -c  don't change colors for directories (useful to printer)
  597. X        -n  display names only
  598. X
  599. X    Displays a directory of specified files. Default output shows
  600. X    date, protection, block size, byte size and total space used.
  601. X    Protections flags include new 1.2/1.3 flags (see under protect).
  602. X    Files are alphabetically sorted, without case sensitivity, and
  603. X    directories are in red pen (unless you use -c).
  604. X
  605. X    DISKCHANGE
  606. X    Usage    : diskchange drive
  607. X
  608. X    Like AmigaDOS diskchange.
  609. X
  610. X    ECHO
  611. X    Usage    : echo [-n] string
  612. X    Example    : echo hi there
  613. X    Results    : hi there
  614. X
  615. X    Echo the string given. If -n switch given no newline is
  616. X    appended.
  617. X
  618. X    ELSE
  619. X    Usage    : else ; command
  620. X    Usage    : if -f foo.c ; else ; echo "Not there" ; endif
  621. X
  622. X    Else clause, must follow an IF statement.
  623. X
  624. X    ENDIF
  625. X    Usage    : endif
  626. X
  627. X    The end of an if statement.
  628. X
  629. X    Note: if you return from a script file with unterminated IF's
  630. X    and the last IF was false, prompt will be changed to an
  631. X    underscore ('_') and no commands will be executed until
  632. X    'endif' is typed.
  633. X
  634. X    EXEC
  635. X    Usage    : exec command
  636. X    Example    : set util SYS:sytem/utilities
  637. X          exec $util/make    # would not work without exec
  638. X
  639. X    Execute the command specified; exec command is equivalent to
  640. X    command, only you can use variables to specify command name.
  641. X
  642. X    FAULT
  643. X    Usage    : fault error1 .. errorN
  644. X    Example    : fault 205 212
  645. X
  646. X    Like AmigaDOS fault, prints specified error messages.
  647. X
  648. X    FILENOTE
  649. X    Usage: filenote file1 .. filen  note
  650. X
  651. X    Set AMIGADOS comment of the specified file. This is not very useful,
  652. X    since in current implementation of Shell file comments are not listed
  653. X    in directory, but it was so easy to implement...
  654. X
  655. X    FLIST
  656. X    Usage    : flist
  657. X
  658. X    Lists the filenumbers of files opened by open.
  659. X    See open and close for more info.
  660. X
  661. X    FLTLOWER
  662. X    Usage    : fltlower
  663. X    Example    : dir | fltlower
  664. X    Or    : fltlower <readme
  665. X
  666. X    This is a filter command, i.e. it reads from stdin and writes to
  667. X    stdout. The more natural way to use it is a pipe, or it can be
  668. X    redirected.
  669. X    Its purpose is to convert all alphabetic to lower case.
  670. X
  671. X    FLTUPPER
  672. X    The same of fltlower, only this converts to upper case.
  673. X
  674. X    FOREACH
  675. X    Usage    : foreach [-v] varname ( strings ) command
  676. X    Example    : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
  677. X    Result    : a ha
  678. X          b ha
  679. X          c ha
  680. X          d ha
  681. X
  682. X    'strings' is broken up into arguments.  Each argument is placed in
  683. X    the variable 'varname' in turn and 'command' executed.  To execute
  684. X    multiple commands, place them in quotes.
  685. X
  686. X    Foreach is especially useful when interpreting passed arguments in
  687. X    an alias.
  688. X
  689. X    eg.
  690. X        foreach i ( *.pic ) viewilbm $i
  691. X    assuming a.pic and b.pic in current directory the following commands
  692. X    will occur:
  693. X        viewilbm a.pic
  694. X        viewilbm b.pic
  695. X
  696. X    Flag -v causes arguments to be displayed every time command is
  697. X    executed.
  698. X
  699. X    FOREVER
  700. X    Usage    : forever command
  701. X    or    : forever "command;command;command..."
  702. X
  703. X    The specified commands are executed over and over again forever.
  704. X
  705. X    -Execution stops if you hit ^C
  706. X    -If the commands return with an error code.
  707. X
  708. X    FORLINE
  709. X    Usage    : forline var filename command
  710. X    or    : forline var filename "command;command..."
  711. X    Example    : forline i RAM:temp "echo line $_linenum=$i"
  712. X
  713. X    For each ASCII line of file specified commands are executed and
  714. X    var points to line content. You can check system variable _linenum
  715. X    to find the number of the line currently read.
  716. X
  717. X    FORNUM
  718. X    Usage    : fornum [-v] var n1 n2 command
  719. X    or    : fornum [-v] -s var n1 n2 step command
  720. X    Example    : fornum -v x 1 10 echo $1
  721. X    or    : fornum -s x 10 1 -1 echo $i # counts backwards
  722. X
  723. X    Executes  command(s)  for  all numerical values of x between n1 and
  724. X    n2.   If  more  than  one  command  is  specified,  or  command  is
  725. X    redirected, include command(s) in quotes.
  726. X    Switch -v (verbose) causes printing of progressive numbers.
  727. X    Switch  -s  allows  you to specify a step; if this is negative, the
  728. X    count will be backwards.
  729. X
  730. X    GOTO
  731. X    Usage    : goto label
  732. X    Example    :
  733. X          label start
  734. X            echo "At start"
  735. X            dir ram:
  736. X            goto start
  737. X
  738. X    Goto  the specified label name.  You can only use this command from
  739. X    a  source  file.   Labels  may  be  forward or reverse from current
  740. X    position.
  741. X
  742. X    HEAD
  743. X    Usage    : head filename [num]
  744. X    Example    : head readme 20
  745. X
  746. X    Display  first "num" lines of "filename".  If num is not specified,
  747. X    10 is assumed.
  748. X
  749. X    HELP
  750. X    Usage    : help
  751. X    Example    : help
  752. X
  753. X    Simply  displays  all  the  available  commands.   The commands are
  754. X    displayed in search-order.  That is, if you give a partial name the
  755. X    first  command  that  matches  that  name  in  this list is the one
  756. X    executed.   Generally,  you  should  specify enough of a command so
  757. X    that it is completely unique.
  758. X
  759. X    HISTORY
  760. X    Usage    : history [partial_string]
  761. X    Example    : history
  762. X
  763. X    Displays  the  enumerated  history  list.   The size of the list is
  764. X    controlled  by  the  _history  variable.   If you specify a partial
  765. X    string, only those entries matching that string are displayed.
  766. X
  767. X    HOWMANY
  768. X    Usage    : howmany
  769. X
  770. X    This  command  tells you how many instances of Shell are running in
  771. X    your system.
  772. X
  773. X    HTYPE
  774. X    Usage    : htype file1 .. filen
  775. X
  776. X    Displays the specified files in hex and ASCII, just like the system
  777. X    command Type file opt h.  Especially suitable for binary files.
  778. X
  779. X    IF
  780. X    Usage    : if [-n] argument conditional argument ;
  781. X    or    : if [-n] argument
  782. X    or    : if [-n] -f file
  783. X    or    : if [-n] -d file/dir
  784. X    or    : if [-n] -m
  785. X    or    : if [-n] -t file file1 .. fileN
  786. X    or    : if [-n] -r rpnexpression
  787. X    or    : if [-n] -v varname
  788. X
  789. X    If a single argument is something to another argument.  Conditional
  790. X    clauses allowed:
  791. X
  792. X    <, >, =, and combinations (wire or).  Thus <> is not-equal, >=
  793. X    larger or equal, etc...
  794. X
  795. X    If arguments are not numeric, they are compared as strings.
  796. X
  797. X    Usually the argument is either a constant or a variable ($varname).
  798. X
  799. X    The second form if IF is conditional on the existance of the argument.
  800. X    If the argument is a "" string, then FALSE, else TRUE.
  801. X
  802. X    The third form of IF used by -f switch checks for existance of
  803. X    the specified file.
  804. X
  805. X    Switch -d tests the type of the object specified: if it is a
  806. X    directory, then TRUE; if it is a file (or it doesn't exist)
  807. X    then FALSE.
  808. X
  809. X    Switch -m is used to test if FAST memory is present, i.e. wheter
  810. X    more than 512K RAM are available.
  811. X    Example (to be included in a login.sh file):
  812. X    if -m; resident -d lc1 lc2 blink; endif
  813. X
  814. X    Using -t form compares the date and time of the first file with
  815. X    all the others; if the first is younger than ALL the others, then
  816. X    FALSE, else TRUE. If a file doesn't exists, it is considered as
  817. X    being older.
  818. X    This feature is especially useful for building makefiles without
  819. X    using any MAKE utility.
  820. X    Example:
  821. X    if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
  822. X
  823. X    Option -r evaluates a given RPN expression (see under RPN for more
  824. X    info): if value on top of stack is 0, then FALSE, else TRUE.
  825. X
  826. X    Switch -n (NOT) reverses the result.
  827. X
  828. X    To test if a given variable is defined, use if -v varname.
  829. X
  830. X    When using 'IF' command interactively if you are entering commands
  831. X    following an 'IF' that was false, the prompt will be set to a
  832. X    underscore '_ ' to indicate all commands will be ignored until
  833. X    an 'ELSE' or 'ENDIF' command is seen.
  834. X
  835. X    INC
  836. X    Usage    : inc varname [value]
  837. X    Example    : inc abc 5
  838. X
  839. X    Increment the numerical equivalent of the variable with specified
  840. X    value (default: 1) and place the ascii-string result back into
  841. X    that variable.
  842. X
  843. X    INFO
  844. X    Usage    : info
  845. X
  846. X    Display Device statistics for all the disk-type devices in system
  847. X    (DFk:, HDk, JHk:, RAM:, RDk: ...), just like the system command
  848. X    info. Gives block used/free, % used, errs, status and volume name.
  849. X
  850. X    INPUT
  851. X    Usage    : input var var ... var
  852. X    Example    : input abc
  853. X
  854. X    Input from STDIN (or a redirection, or a pipe) to a variable.  The
  855. X    next input line is placed in the variable.
  856. X
  857. X    JOIN
  858. X    Usage    : join [-r] file1..fileN destfile
  859. X    Example    : join part1 part2 part3 total
  860. X
  861. X    Joins the specified files to get destfile. If destfile already
  862. X    exists, an error message is generated and operation is aborted,
  863. X    unless you specify -r (replace) option.
  864. X
  865. X    LABEL
  866. X    Usage    : label name
  867. X
  868. X    Create a program label right here. Used in source files, can then
  869. X    GOTO a label.
  870. X
  871. X    LS
  872. X    Equivalent to dir.
  873. X
  874. X    MD
  875. X    Equivalent to mkdir.
  876. X
  877. X    MAN
  878. X    Usage    : man command(s)
  879. X    Example    : man mkdir
  880. X
  881. X    Get  info about a Shell command, or others keywords.  These include
  882. X    all  special  _variables, plus various keywords:  WILDCARDS, PIPES,
  883. X    EDITING, and more.
  884. X    See special alias manlist to get a list of ALL keywords supported
  885. X    by man.
  886. X    You  must  assign DOC:  to the directory containing Shell.doc (this
  887. X    file) to use this command.
  888. X
  889. X    MEM
  890. X    Usage    : mem
  891. X
  892. X    Display  current  memory statistics for CHIP memory and FAST memory
  893. X    (if any installed).
  894. X
  895. X    MKDIR (MD)
  896. X    Usage    : mkdir name name name...
  897. X    Example    : mkdir df0:stuff
  898. X
  899. X    Create the specified directories.
  900. X
  901. X    MV
  902. X    Equivalent to rename.
  903. X
  904. X    OPEN
  905. X    Usage    : open filename filemode filenumber
  906. X    Example    : open RAM:data w 1
  907. X
  908. X    This  allows you to open a file, redirect to it as many commands as
  909. X    you like, then close it.
  910. X    Filename is any valid AmigaDOS filename, filemode is either "r" for
  911. X    read or "w" for write, filenumber is a number between 1 and 10.
  912. X    To  redirect  a  program to or from an open file, use as your redir
  913. X    filename a dot followed by the filenumber.
  914. X    Here is a complete example:
  915. X
  916. X        open RAM:data w 1
  917. X        echo -n 2+2= >.1
  918. X        rpn 2 2 + . CR >.1
  919. X        close 1
  920. X        type RAM:data    # will display 2+2=4
  921. X
  922. X    See also close, flist.
  923. X
  924. X    PATH
  925. X    Usage    : path
  926. X
  927. X    Used to list AmigaDOS path. In current version can't be used to
  928. X    set it.
  929. X
  930. X    PRI
  931. X    Usage    : pri clinumber pri
  932. X    Example    : pri 3 5    # set priority of cli #3 to 5
  933. X
  934. X    Change the priority of the specified task (use PS command to
  935. X    determine clinumber). If you specify 0 as clinumber you can
  936. X    change priority of "this" task (the one executing shell).
  937. X
  938. X    PROTECT
  939. X    Usage    : protect file1 ... filen [flags]
  940. X    Example    : protect myfile rwe
  941. X
  942. X    Set AMIGADOS file protection flags for the file specified. Valid
  943. X    flags are h, s, p, a, r, w, e, d.
  944. X    If you don't specify the flags, all flags are cleared.
  945. X    Bit 'a' is new to WorkBench 1.2, while 'h', 's', 'p' are new to 1.3.
  946. X
  947. X    PS
  948. X    Usage    : ps
  949. X
  950. X    Gives status of DOS processes.  eg:
  951. X
  952. X    Proc Command Name    CLI Type    Pri.  Address  Directory
  953. X     1   SHELL        Initial CLI   0      97b0  Stuff:shell
  954. X     2   sys:c/clockmem    Background  -10    2101a8  Workdisk:
  955. X     3   c:emacs        Background    0    212f58  Stuff:shell
  956. X     4   sys:c/VT100    Background    0    227328  Workdisk:
  957. X
  958. X    Address is the addres of the task, directory is the process
  959. X    currently CD'd directory.
  960. X
  961. X    PWD
  962. X    Usage    : pwd
  963. X
  964. X    Rebuild _cwd by backtracing from your current directory.
  965. X
  966. X    QUIT
  967. X    Usage    : quit
  968. X
  969. X    Quit out of Shell back to CLI.
  970. X
  971. X    RBACK
  972. X    Usage    : rback command
  973. X
  974. X    Start a new process executing the specified command, but can't do
  975. X    input/output. Equivalent to 'run command >NIL: <NIL:'.
  976. X
  977. X    RENAME (MV)
  978. X    Usage    : rename from to
  979. X    or    : rename from from from ... from todir
  980. X
  981. X    Allows you to rename a file or move it around within a disk.
  982. X    Allows you to move 1 or more files into a single directory.
  983. X
  984. X    RESIDENT
  985. X    Usage    : resident [-r][-d] [files]
  986. X    Example    : resident lc1 lc2 blink    # load these as resident
  987. X          resident -d lc1 lc2 blink    # defer load when needed
  988. X          resident -r lc1 lc2 blink    # remove these
  989. X          resident            # list resident programs
  990. X
  991. X    This is ARP resident. Commands are searched by Shell in resident
  992. X    list BEFORE of searching on any external device.
  993. X    Only PURE programs can run as resident, see ARP docs for more info.
  994. X    Option -d is very useful: you can say, in your startup file,
  995. X    resident -d file...file; programs will not be loaded immediately,
  996. X    but only when you will try to load them. This way, you will not
  997. X    waste memory and startup time if you don't use the programs.
  998. X    Old option -a has no more effect.
  999. X
  1000. X    RETURN
  1001. X    Usage    : return [n]
  1002. X    Example    : return 10
  1003. X
  1004. X    Exit from a script file, or quit from shell with optional
  1005. X    exit code.
  1006. X
  1007. X    RM
  1008. X    Equivalent to delete.
  1009. X
  1010. X    RPN
  1011. X    Usage    : rpn expression
  1012. X    Example    : rpn 3 7 *    # Prints the value 21
  1013. X
  1014. X    Evaluate an RPN expression, using 32-bit values. In older versions
  1015. X    of Shell RPN contained string functions too, but now that strings
  1016. X    are handled by specifical commands, these are no more needed.
  1017. X    At end of evaluation, RPN prints values on stack, so you can
  1018. X    say for instance "rpn $x 2 * | input x" to double the value of
  1019. X    variable x.
  1020. X    Functions implemented are:
  1021. X
  1022. X        + - * /    Obvious meaning; / means integer division, of course
  1023. X        %        Module operator e.g. "rpn 7 3 %" answers 1
  1024. X        & | ~    Bitwise and, or, not operators
  1025. X        > < ==    Tests for greater-than, lower-than, equal. To get
  1026. X            a test for >= (or <=), you can use < ! (or > !)
  1027. X        !        Logical not operator
  1028. X        DUP        Duplicate value on top of stack
  1029. X        DROP    Drop value on top of stack
  1030. X        SWAP    Swap two values on top of stack
  1031. X
  1032. X    To avoid confusion with redirections, > and < operators must be
  1033. X    enclosed in quotes e.g.
  1034. X
  1035. X        3 2 ">"        # Prints 1
  1036. X
  1037. X    RUN
  1038. X    Usage    : run prgm args
  1039. X    Example    : run emacs test.c
  1040. X
  1041. X    Start a new process executing the specified command.
  1042. X    In current implementation run command can't be redirected.
  1043. X    This command is not fully reliable: use at your own risk.
  1044. X    See also rback.
  1045. X
  1046. X    RXREC
  1047. X    Usage    : rxrec [portname]
  1048. X
  1049. X    Create an AREXX-compatible port of the specified name (defaults to
  1050. X    "rexx_csh"), then puts Shell to sleep waiting for messages on it.
  1051. X
  1052. X    CAUTION: the only way to exit from this status is to send to the port
  1053. X    the message "bye".
  1054. X
  1055. X    Example:
  1056. X    Open two Shell's in two separate CLI's. From the first, type:
  1057. X
  1058. X        rxrec
  1059. X
  1060. X    Now first Shell doesn't respond to keyboard input; instead, it waits
  1061. X    for messages on a port called "rexx_csh". Now, from the other, type:
  1062. X
  1063. X        rxsend rexx_csh "dir df0:"
  1064. X
  1065. X    You will see the listing of df0: in the first Shell. Experiment as you
  1066. X    like, then:
  1067. X
  1068. X        rxsend rexx_csh bye
  1069. X
  1070. X    And all will return to normal.
  1071. X
  1072. X    RXSEND
  1073. X    Usage    : rxsend portname commands
  1074. X
  1075. X    Send a command to any program with an AREXX-compatible port.
  1076. X    You don't have to load anything to use these command (or rxrec):
  1077. X    all you need is a program with the right port.
  1078. X
  1079. X    An example is CygnusEdProfessional: here is, for instance, a command
  1080. X    to wake it up, load the file test.c and jump to line 20:
  1081. X
  1082. X        rxsend rexx_ced cedtofront "open test.c" "jmp to line 20"
  1083. X        # rexx_ced is the name of AREXX port for CygnusEd
  1084. X
  1085. X    Refer to your application manual for details and for the name of the
  1086. X    port.
  1087. X
  1088. X    SEARCH
  1089. X    Usage    : search [-w][-c][-n][-r][-e][-q] filelist string
  1090. X
  1091. X    Search specified files for a string. Only lines containing the
  1092. X    specified strings are displayed.
  1093. X
  1094. X    If the filename is STDIN (in uppercase) the standard input is
  1095. X    used, so you can use search as the destination for a pipe.
  1096. X    Example:
  1097. X        strings myprog 8 | search STDIN .library
  1098. X    Lists all libraries used in "myprog".
  1099. X
  1100. X    If you specify any directory in filelist, and use the -r (recurse)
  1101. X    switch, all files in directory are recursively searched.
  1102. X
  1103. X    Lines are numbered by default; use -n (number) switch to turn off
  1104. X    line numbering.
  1105. X
  1106. X    Search is normally not case sensitive; use -c (case) flag to turn ON
  1107. X    case sensitivity.
  1108. X
  1109. X    By specifying -e (exclude) switch, only lines NOT containing the
  1110. X    specified string are listed.
  1111. X
  1112. X    Using -w (wild) flag, only the lines matching with the string are
  1113. X    listed.
  1114. X    Notes to wild card matching;
  1115. X    - Uses Shell standard matching.
  1116. X    - All standard ARP wildcards are allowed * ? [] () | ~ ' #
  1117. X    - The WHOLE line must match the string, not only a substring.
  1118. X    - String MUST be enclosed in quotes to avoid wildcard expansion
  1119. X
  1120. X    Flag -q (quiet) suppresses printing of file names.
  1121. X
  1122. X    Examples:
  1123. X        search -cr df0:include ACCESS
  1124. X    Find all occurrencies of ACCESS (in uppercase) in all files
  1125. X    contained in include directory.
  1126. X        search -w shell.h "'#define*"
  1127. X    Lists only lines of file beginning with (not simply containing)
  1128. X    #define. Note the use of ' to escape the special symbol #.
  1129. X
  1130. X    SET
  1131. X    Usage    : set [name] [string]
  1132. X    Example    : set abc hello
  1133. X
  1134. X    Set with no args lists all current variable settings.
  1135. X    Set with one arg lists the setting for that particular variable.
  1136. X    Specifying name and string, stores the string into variable name.
  1137. X
  1138. X    Also See the section on special _variables.
  1139. X
  1140. X
  1141. X    SLEEP
  1142. X    Usage    : sleep timeout
  1143. X    Example    : sleep 10
  1144. X
  1145. X    Sleep for 'timeout' seconds, or until ^C typed.
  1146. X
  1147. X    STACK
  1148. X    Usage    : stack [number]
  1149. X    Example    : stack 8000
  1150. X
  1151. X    Changes the default stack for this CLI. Without arguments, prints
  1152. X    it.
  1153. X
  1154. X    STRHEAD
  1155. X    Usage    : strhead varname breakchar string
  1156. X    Example    : strhead x . foobar.bas    # Will set x to "foobar"
  1157. X
  1158. X    Remove everything after and including the breakchar in 'string' and
  1159. X    place in variable 'varname'.
  1160. X
  1161. X    STRINGS
  1162. X    Usage    : strings file1..fileN minlenght
  1163. X    Example    : strings c:dir c:list shell 7
  1164. X
  1165. X    Prints strings contained in specified files (usually binary)
  1166. X    with lenght >= minlenght.
  1167. X
  1168. X    STRLEFT
  1169. X    Usage    : strleft varname string n
  1170. X    Example    : strleft x LongString 5    # Will set x to "LongS"
  1171. X
  1172. X    Place leftmost n chars of string in variable varname.
  1173. X
  1174. X    STRLEN
  1175. X    Usage    : strlen varname string
  1176. X    Example    : strlen x Hello        # Will set x to "5"
  1177. X
  1178. X    Puts len of string in variable varname.
  1179. X
  1180. X    STRMID
  1181. X    Usage    : strmid varname string n1 [n2]
  1182. X    Example    : strmid x LongString 5 3    # Will set x to "Str"
  1183. X
  1184. X    Places n2 chars from string, starting at n1, in variable varname.
  1185. X    By omitting n2, you get all chars from n1 to end of string.
  1186. X
  1187. X    STRRIGHT
  1188. X    Usage    : strright varname string n
  1189. X    Example    : strright x LongString 5    # Will set x to "tring"
  1190. X
  1191. X    Place rightmost n chars of string in variable varname.
  1192. X
  1193. X    STRTAIL
  1194. X    Usage    : strtail varname breakchar string
  1195. X    Example    : strtail x . foobar.bas    # Will set x to "bas"
  1196. X
  1197. X    Remove everything before and including the breakchar in 'string' and
  1198. X    place in variable 'varname'.
  1199. X
  1200. X    SOURCE
  1201. X    Usage    : source file [arguments]
  1202. X    Example    : source mymake.sh all
  1203. X    Result    : source file 'mymake.sh' called with var _passed = 'all'
  1204. X
  1205. X    Execute commands from a file.  You can create SHELL programs in
  1206. X    a file and then execute them with this command.  Source'd files
  1207. X    have the added advantage that you can have loops in your command
  1208. X    files (see GOTO and LABEL).  You can pass SOURCE files arguments
  1209. X    by specifying arguments after the file name.  Arguments are passed
  1210. X    via the _passed variable (as a single string).
  1211. X
  1212. X    Long lines may be split by appending a backslash (\) at end of
  1213. X    first half. However, even joined lines cannot be longer than
  1214. X    ~255 chars. See example of source files.
  1215. X
  1216. X    Automatic 'sourcing' is accomplished by placing a .sh extension on
  1217. X    the file and executing it as you would a C program:
  1218. X
  1219. X    --------- file hello.sh ---------
  1220. X    foreach i ( $_passed ) "echo yo $i"
  1221. X    ---------------------------------
  1222. X
  1223. X    $ hello a b c
  1224. X    yo a
  1225. X    yo b
  1226. X    yo c
  1227. X
  1228. X    TACKON
  1229. X    Usage    : tackon var pathname filename
  1230. X    Example    : tackon x df0:c Dir    # sets x to "df0:c/Dir"
  1231. X    or    : tackon x df0: Preferences #sets x to "df0:Preferences"
  1232. X
  1233. X    Correctly  adds  a  filename  to a pathname, and puts the result in
  1234. X    variable specified.
  1235. X
  1236. X    TAIL
  1237. X    Usage    : tail filename [num]
  1238. X    Example    : tail readme 20
  1239. X
  1240. X    Display  last  "num" lines of "filename".  If num is not specified,
  1241. X    10 is assumed.
  1242. X
  1243. X    TEE
  1244. X    Usage    : tee
  1245. X    Example    : cc test.c | tee >error.list
  1246. X
  1247. X       This  one is a classic "pipe fitting":  it copies standard input
  1248. X    both to standard output and standard error.
  1249. X
  1250. X    TYPE
  1251. X    Equivalent to CAT.
  1252. X
  1253. X    TOUCH
  1254. X    Usage    : touch file1 .. fileN
  1255. X
  1256. X    Sets DateStamp on the specified files to the current date and time.
  1257. X
  1258. X    UNALIAS
  1259. X    Usage    : unalias name .. name
  1260. X    Example    : unalias vt
  1261. X
  1262. X    Delete aliases..
  1263. X
  1264. X    UNIQ
  1265. X    Usage    : uniq
  1266. X
  1267. X    This  is  a  filter  commands, that removed consecutive, duplicated
  1268. X    lines in a file.  It is most useful on a sorted file.
  1269. X
  1270. X    UNSET
  1271. X    Usage    : unset name .. name
  1272. X    Example    : unset abc
  1273. X
  1274. X    Unset one or more variables.  Deletes them entirely.
  1275. X
  1276. X    VER
  1277. X    Usage    : ver
  1278. X
  1279. X    Show current version name, & authors.
  1280. X
  1281. X    WINDOW
  1282. X    Usage    : window [-q][-f][-b][-l][-s] [dimensions]
  1283. X    Options    :
  1284. X        -f    (front) Window to front
  1285. X        -b    (back)  Window to back
  1286. X        -l    (large) Window to maximum size
  1287. X        -s    (small) Window to minimum size
  1288. X        -a    (activate)
  1289. X        -q    (query) Lists screens and windows open
  1290. X
  1291. X       Various  operations on CLI window.  If dimensions are specified,
  1292. X    they must be in the form x y width height, with values separated by
  1293. X    spaces.
  1294. X       The  command  "window  -l" may be very useful on PAL machines to
  1295. X    get  a  full  PAL  window  from  your login sequence, or if you use
  1296. X    overscan WorkBench.
  1297. X       Option  -q  gives,  for  each  Screen and Window currently open,
  1298. X    title, left edge, top edge, width, height.
  1299. X
  1300. X
  1301. XIX. SPECIAL SET VARIABLES
  1302. X-------------------------
  1303. X
  1304. X    _prompt
  1305. X       This  variable  is  set  to  the string you wish printed as your
  1306. X    prompt.
  1307. X       This  can  contain  escape  sequences  if  you  wish, or you can
  1308. X    include a %p in path definition to get CD in your prompt.
  1309. X       Default  prompt shows path specification in red pen, followed by
  1310. X    a greater (>) sign and a space.
  1311. X       The  if  command  will  set the prompt to a '_ ' if commands are
  1312. X    disabled while waiting for a 'endif' or 'else' command (interactive
  1313. X    mode only.
  1314. X
  1315. X    _history
  1316. X       This variable is set to a numerical value, and specifies how far
  1317. X    back your history should extend.
  1318. X
  1319. X    _debug
  1320. X    Debug mode... use it if you dare.  must be set to some value
  1321. X
  1322. X    _verbose
  1323. X    Verbose mode (for source files).  display commands as they are
  1324. X    executed.
  1325. X
  1326. X    _maxerr
  1327. X    The worst (highest) return value to date.  To use this, you usually
  1328. X    set it to '0', then do some set of commands, then check it.
  1329. X
  1330. X    _lasterr
  1331. X    Return code of last command executed.  This includes internal
  1332. X    commands as well as external comands, so to use this variables
  1333. X    you must check it IMMEDIATELY after the command in question.
  1334. X
  1335. X    _cwd
  1336. X    Holds a string representing the current directory we are in from
  1337. X    root.  The SHELL can get confused as to its current directory if
  1338. X    some external program changes the directory.  Use PWD to rebuild
  1339. X    the _cwd variable in these cases.
  1340. X
  1341. X    _passed
  1342. X    This variable contains the passed arguments when you SOURCE a file
  1343. X    or execute a .sh file.  For instance:
  1344. X
  1345. X    test a b c d
  1346. X
  1347. X    -------- file test.sh ----------
  1348. X    echo $_passed
  1349. X    foreach i ( $_passed ) "echo YO $i"
  1350. X    --------------------------------
  1351. X
  1352. X    _path
  1353. X    This variable contains the search path when the shell is looking
  1354. X    for external commands.  The format is:  DIR,DIR,DIR  Each DIR must
  1355. X    have a trailing ':' or '/'.  The current directory is always
  1356. X    searched first.  The entire path will be searched first for the
  1357. X    <command>, then for <command>.sh (automatic shell script sourcing).
  1358. X
  1359. X    The default _path is set to
  1360. X        ram:,ram:c/,df0:c/,df1:c/,df0:,df1:,sys:system/
  1361. X
  1362. X    _insert
  1363. X    Sets the default for insert/overtype mode for command line
  1364. X    editing. ^A toggles between, but after <RET> the default is
  1365. X    set back as indicated by this variable. By default _insert is 1
  1366. X    indicating insert mode on setting to zero will make overtype
  1367. X    the default.
  1368. X
  1369. X    _titlebar
  1370. X    Used to set window's title bar.
  1371. X
  1372. X    _clinumber
  1373. X    Contains the number (1-20) of current CLI.
  1374. X
  1375. X    _except
  1376. X    See EXCEPTION
  1377. X
  1378. XX.  EXCEPTION PROCESSING
  1379. X------------------------
  1380. X
  1381. X    EXCEPTION PROCESSING
  1382. X    If  no  _except variable exists, any command which fails causes the
  1383. X    rest of the line to abort as if an ABORTLINE had been executed.  If
  1384. X    the _except variable exists, it is of the form:
  1385. X
  1386. X    "nnn;commands..."
  1387. X
  1388. X    where  nnn  is  some  value  representing  the  minimum return code
  1389. X    required  to  cause  an  error.   Whenever a command returns a code
  1390. X    which  is  larger  or  equal  to  nnn,  the commands in _except are
  1391. X    executed  before  anything.   WHEN _except EXISTS, THE COMMAND LINE
  1392. X    DOES  NOT  ABORT AUTOMATICALLY.  Thus, if you want the current line
  1393. X    being executed to be aborted, the last command in _except should be
  1394. X    an "abortline".
  1395. X
  1396. X    Exception  handling  is  disabled  while  in the exception handling
  1397. X    routine (thus you can't get into any infinite loops this way).
  1398. X
  1399. X    Thus if _except = ";", return codes are completely ignored.
  1400. X
  1401. X    Example:
  1402. X
  1403. X    set _except "20;abortline"
  1404. X
  1405. XXI. EXAMPLE SOURCE FILES
  1406. X------------------------
  1407. X
  1408. XIf from a CLI or the startup-script you say 'SHELL filename', that file is
  1409. Xsourced first.
  1410. XMoreover, if you have a file called S:.login, it will be sourced for every
  1411. XShell you run. This is useful for aliases and setting that you want in ALL
  1412. XShells.
  1413. X
  1414. X
  1415. X### Example S:.login ###
  1416. X
  1417. XHere is an example .login file:
  1418. X
  1419. Xset F5 "cdir WORK:"^M
  1420. Xset f9 "ed s:login.sh"^M
  1421. Xset F9 "ed df0:s/startup-sequence"^M
  1422. Xalias toram  "%q foreach i ( $q ) \"cp -r $i: ram:$i >NIL:;\
  1423. X    assign $i: ram:$i\""
  1424. Xalias ramop  "md RAM:op; assign OP: ram:op"
  1425. Xalias noop   "assign OP: ; rm -r ram:op"
  1426. Xalias newop  "rm -r OP:*"
  1427. Xalias dc     "dfc df0: to df1:"
  1428. Xalias go     "%q assign WORK: Boot:$q; cd WORK:; source startme.sh"
  1429. Xalias get    "%q cp $q RAM: >NIL:"
  1430. X
  1431. X#This one puts current directory and cli number on prompt !!!!!!
  1432. Xset _prompt ^[[33m[$_clinumber].%p>" "
  1433. X
  1434. X# this one puts current directory on window titlebar !!!!!!
  1435. Xalias cd     "%q \\cd $q; set _titlebar CWD: $_cwd"
  1436. X
  1437. X# This file will be sourced for every Shell you start
  1438. X
  1439. X### End of example .login ###
  1440. X
  1441. X****************************************************************************
  1442. X
  1443. XIf you are a CLI user, your startup-sequence may be as simple as:
  1444. X
  1445. X    C:Shell S:startup.sh
  1446. X
  1447. XHere is, my startup code:
  1448. X
  1449. X### Example S:startup.sh ###
  1450. X
  1451. Xwind -l    # if you are on a PAL machine, or use overscan
  1452. X    # note that commands may be abbreviated (wind=window)
  1453. X
  1454. Xassign LC:    Stuff:c
  1455. Xassign INCLUDE:    Stuff:include
  1456. Xassign LIB:    Boot:lib
  1457. Xassign QUAD:    RAM:
  1458. X
  1459. Xrback C:FaccII; sleep 1
  1460. X    # after spawning a process, it is always better to allow it
  1461. X    # to load the command, to avoid excessive drive head movement
  1462. X
  1463. Xresident -d blink lc1 lc2 >NIL:
  1464. X    #defer loading
  1465. X
  1466. XC:PopCli 300 C:Newcli
  1467. X    #using full pathname loads faster (even without Shell)
  1468. XC:FF -1 Siesta.font >NIL:
  1469. XC:Patch_1 >NIL:
  1470. Xstack 8000
  1471. X    # lc1 and lc2 need this
  1472. X
  1473. Xsource S:setdate.sh    # this is listed in next chapter
  1474. X
  1475. X### End of example startup.sh ###
  1476. X
  1477. X****************************************************************************
  1478. X
  1479. XThe following is an example source file to set date and time; it may be
  1480. Xused at startup if you don't have an internal clock.
  1481. X
  1482. X### setdate.sh ###
  1483. X
  1484. Xopen CON:200/100/440/80/SetDate write 1
  1485. Xecho >.1 -n "Current date is "
  1486. Xdate >.1
  1487. Xecho >.1 -n "Please enter date: "
  1488. Xinput <.1 d
  1489. Xclose 1
  1490. Xstrlen len $d
  1491. Xif $len > 1 ; date $d ; endif
  1492. Xecho -n "New date: " ; date
  1493. X
  1494. X### End of setdate.sh ###
  1495. X
  1496. X***************************************************************************
  1497. X
  1498. XNext comes a makefile that needs no Make program: may be executed from
  1499. XShell directely!!!
  1500. X
  1501. X### make.sh ###
  1502. X
  1503. Xif -t Shell.syms Shell.h; cc +HShell.syms Shell.h; rm shell.o; endif
  1504. Xif -t RAM:Shell.syms Shell.syms; cp -d Shell.syms RAM:; endif
  1505. X
  1506. Xforeach i ( main comm1 comm2 comm3 execom globals rawconsole run set \
  1507. X sub ) "if -t $i.o $i.c; echo Compile $i...;cc +IRAM:shell.syms $i.c; endif"
  1508. X
  1509. Xif -t Shell run.o main.o comm1.o comm2.o comm3.o execom.o \
  1510. Xset.o sub.o globals.o rawconsole.o
  1511. X    ln  +q -m -o Shell run.o main.o comm1.o comm2.o comm3.o\
  1512. X    execom.o set.o sub.o globals.o rawconsole.o -la -lc
  1513. Xendif
  1514. X
  1515. X### End of make.sh ###
  1516. X
  1517. X
  1518. XXII.  Default Values
  1519. X--------------------
  1520. X
  1521. XTo make things easier, some aliases are predefined whenever you start a
  1522. Xnew Shell. These are:
  1523. X
  1524. X    MANLIST
  1525. X    Display  a list of possible arguments to man.  You can pipe this to
  1526. X    sort to get a sorted output.
  1527. X
  1528. X    CLS
  1529. X    Simply clear the screen.
  1530. X
  1531. X    CDIR
  1532. X    Use "cdir directory" to clear the screen, set CD to directory,
  1533. X    and list it.
  1534. X
  1535. X    KR
  1536. X    Deletes everything on RAM:. If you think this is dangerous,
  1537. X    you can remove this alias.
  1538. X
  1539. X    EXIT
  1540. X    Leave Shell and exit CLI.
  1541. X
  1542. X    LP
  1543. X    List to printer one or more files.
  1544. X
  1545. XMoreover, many variables have default values, and many function keys are
  1546. Xpredefined. You can use set command to determine all of these.
  1547. X
  1548. XXIII.  Why ARP ?
  1549. X----------------
  1550. X
  1551. X    ARP
  1552. X    For  those  of you curious enough, the A in "4.xxA" means ARP.  The
  1553. X    most  recent versions of Shell use ARP.library.  This has been very
  1554. X    useful in:
  1555. X
  1556. X    -  Implementing  commands like ASET, ASSIGN, INFO, RESIDENT, RBACK,
  1557. X       RUN.
  1558. X    - Keeping executable code small.
  1559. X
  1560. X    ARP.library  is  really public domain, so one can include it in any
  1561. X    package,  both  commercial  or  public domain, like I am doing with
  1562. X    Shell.   The  ARP  team  is trying to wipe out the BCPL from AMIGA.
  1563. X    This  is  a  very good idea, I think.  And there is a lot of people
  1564. X    hoping that Commodore will put ARP.library in ROM, before or after.
  1565. X    This  would make the AMIGA a much more friendly computer to use and
  1566. X    program.   I  encourage programmers to get ARP development package:
  1567. X    you  can  find  it on many BBS, and is really public domain.  Users
  1568. X    can  look  for  a  replacement  of  C:   commands from ARP (but, of
  1569. X    course,  if  you use this Shell you won't need them anymore, except
  1570. X    for ARUN).
  1571. END_OF_FILE
  1572. if test 47293 -ne `wc -c <'shell.doc'`; then
  1573.     echo shar: \"'shell.doc'\" unpacked with wrong size!
  1574. fi
  1575. # end of 'shell.doc'
  1576. fi
  1577. echo shar: End of archive 3 \(of 3\).
  1578. cp /dev/null ark3isdone
  1579. MISSING=""
  1580. for I in 1 2 3 ; do
  1581.     if test ! -f ark${I}isdone ; then
  1582.     MISSING="${MISSING} ${I}"
  1583.     fi
  1584. done
  1585. if test "${MISSING}" = "" ; then
  1586.     echo You have unpacked all 3 archives.
  1587.     rm -f ark[1-9]isdone
  1588. else
  1589.     echo You still need to unpack the following archives:
  1590.     echo "        " ${MISSING}
  1591. fi
  1592. ##  End of shell archive.
  1593. exit 0
  1594. -- 
  1595. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  1596. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  1597. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  1598.